package com.niit.serviceuser.service.impl;

import com.niit.common.entity.TbUser;
import com.niit.serviceuser.mapper.TbUserMapper;
import com.niit.serviceuser.service.TbUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbUserServiceImpl implements TbUserService {

    @Autowired
    private TbUserMapper tbUserMapper;

    @Override
    public List<TbUser> getAllUsers() {
        return tbUserMapper.selectAll();
    }

    @Override
    public TbUser getUserById(Long id) {
        return tbUserMapper.selectById(id);
    }

    @Override
    public int createUser(TbUser user) {
        return tbUserMapper.insert(user);
    }

    @Override
    public int updateUser(TbUser user) {
        return tbUserMapper.update(user);
    }

    @Override
    public int deleteUser(Long id) {
        return tbUserMapper.deleteById(id);
    }
}